Add array_dot_product / list_dot_product function#12476
Add array_dot_product / list_dot_product function#12476austin362667 wants to merge 4 commits intoapache:mainfrom
array_dot_product / list_dot_product function#12476Conversation
Signed-off-by: Austin Liu <austin362667@gmail.com>
Signed-off-by: Austin Liu <austin362667@gmail.com>
Signed-off-by: Austin Liu <austin362667@gmail.com>
Signed-off-by: Austin Liu <austin362667@gmail.com>
|
Hey @austin362667 Maybe you should take a look at this discussion #12357 once |
|
Thank you, @dharanad , for bringing this to my attention. This is a great discussion. I like the idea of keeping the DataFusion core as simple as possible while retaining useful DuckDB functions that enhance the user experience. I'm open to any feedback~ |
What would you think about creating a new crate in https://github.com/datafusion-contrib to hold additional duckdb functions? Perhaps https://github.com/datafusion-contrib/datafusion-functions-duckdb, similar to https://github.com/datafusion-contrib/datafusion-functions-json for JSON from @samuelcolvin and co. It would be a pretty neat way to help build out the function library in DataFUsion Also, @matthewmturner and I have been working on an integration UI similar to |
|
Sure, thank you Andrew for proposing this initiative. |
Awesome -- let's try a new repo. Follow on discussion here: #12254 (comment) |
Which issue does this PR close?
Closes #12475.
Rationale for this change
Add dot product functionality to DataFusion. It would be valuable to add scalar UDF
array_dot_product/list_dot_productwhich computes inner product of two arrays, that is already supported by well-known DBs like DuckDB.What changes are included in this PR?
convert_to_f64_arraytofunctions-nested/utils.rs.array_dot_product/list_dot_productinfunctions-nested.array.slt.Are these changes tested?
Yes, added some array-specific SQL logic test, including
List/LargeList/FixedSizedListAre there any user-facing changes?
Yes, new function
array_dot_product(arr1, arr2)is added.For instance,